package com.freecloud.framework.utils;

import cn.hutool.core.util.StrUtil;

/**
 */
public class GPSUtil {


    /**
     * GPS经纬度 116° 27' 52.46"格式转double类型
     * @param stringDMS
     * @return
     */
    public static Double convertToDegree(String stringDMS){
        Float result = null;

        //度
        String[] array = stringDMS.split("°");
        Double FloatD = new Double (StrUtil.trim (array[0]));

        //分
        array = array[1].split ("'");
        Double FloatM = new Double (StrUtil.trim (array[0]));

        //秒
        array = array[1].split ("\"");
        Double FloatS = new Double (StrUtil.trim (array[0]));

        result = new Float(FloatD + (FloatM/60) + (FloatS/3600));
        return (double) result;
    }
}
